<?php
$this->breadcrumbs=array(
	'实验室'=>array('index'),
	'创建新项目',
);

$this->menu=array(
	array('label'=>'List Project', 'url'=>array('index')),
	array('label'=>'Manage Project', 'url'=>array('admin')),
);

//定义URL地址
$createUrl = $this->createUrl('/labs/create');
?>

<script type="text/javascript">


$(function(){

	
	$("#parallaxButton").click(function(){

		if($("#Project_pro_tags").val() == ''){
		    $.msgbox({
			    height:100,
			    width:300,
			    content:{type:'alert', content:'项目名称不能为空……'},
			    animation:4
			}); 
		}
		
		if(editor_a.hasContents()){
			
			var data = {
				'Project[pro_tags]':$("#Project_pro_tags").val(),
				'Project[pro_introduce]':editor_a.getContent(),
				'rn':Math.random()
			};

			$.post('<?php echo $createUrl;?>', data, function(msg){

				msg = msg.split('_#_');

				if(msg[0] == 'success'){
				    $.msgbox({
					    height:100,
					    width:300,
					    content:{type:'confirm', content: '现在添加项目的解决方案吗？<br /><a class="example" href="<?php echo $this->createUrl('create');?>">我还有问题……</a>'},
					    animation:4,
					    onClose:function(v){
					        if(v){	                   
					        	location.href = msg[1];
					      
					        }else{
								location.href = '<?php echo $this->createUrl('list');?>';
					        }
					        
					    }
					}); 
				}
				
				console.log(msg);
			});			
			
		}else{
		    $.msgbox({
			    height:100,
			    width:300,
			    content:{type:'alert', content: '项目内容简介不能为空！'},
			    animation:4

			}); 
		}
	});
	
});
</script>
<?php if(Yii::app()->user->hasFlash('successInfo')): ?>
<div class="flash-success">
	<?php echo Yii::app()->user->getFlash('successInfo'); ?>
</div>
<?php else: ?>

<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>

<?php endif; ?>
<?php $this->widget('ext.box.colorbox.colorboxWidget',array(
		'id'=>'.example',
		'theme'=>'example1',
		'options'=>'width:"90%", height:"90%", iframe:true'
));?> 